export function range(begin: number, end: number, step = 1) {
	return {
		[Symbol.iterator]: function* generateRange() {
			let x = begin - step;
			while (x < end - step) yield (x += step);
		},
	};
}

export function genText() {
	return [...range(1, Math.random() * 30 + 1)]
		.map(() => {
			const v = 0x4e00 + Math.floor(Math.random() * (0x9fa5 - 0x4e00));
			return String.fromCharCode(v);
		})
		.reduce((p, v) => p + v);
}
